﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Security.Policy;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using BLL;

namespace StudentAppointmentPlatform
{
    public partial class _Default : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                string loginType = Session["LoginType"] as string;
                if (loginType == null)
                {
                    Info_notLogin.Visible = true;
                    Function.Visible = false;
                }
                else
                {
                    Info_hasLogin.Visible = true;
                    if (loginType == "Director")
                    {
                        TypeName.Text = " 负责人 ";
                        Func_AddService.Visible = true;
                        ShowSrevicesLink.Text = "查看您创建的服务项";
                        ShowHistoryLink.Text = "查看您管理的服务的预约记录";
                    }
                    else if (loginType == "Student")
                    {
                        TypeName.Text = " 学生 ";
                        ShowSrevicesLink.Text = "查看可预约的服务项";
                        ShowHistoryLink.Text = "查看历史预约记录";
                    }

                    string userId = Session["UserId"].ToString();
                    int uid = UserBO.GetIdByUserId(userId);
                    if (uid != -1)
                    {
                        int unreadMsgNum = MessageBO.GetUnreadMsgNum(uid);
                        litMessageNum.Text = unreadMsgNum != 0 ? "(" + unreadMsgNum + ")" : "";
                    }
                }
            }
        }
    }
}
